package cn.edu.ahstu.acm.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import cn.edu.ahstu.acm.entity.Config;

public interface ConfigMapper{

	@Insert("insert into `config` (`key`, `value`, `description`, `createTime`, `modifyTime`) values (#{key},#{value}, '', now(), now())")
	public void save(Config config);

	@Select("select * from `config` where `key`=#{key}")
	public Config query(String key);

	@Select("select * from `config`")
	public List<Config> queryForList(Object param, Long offset, Long pagesize);

	@Delete("delete from `config` where `key`=#{key}")
	public void delete(Config config);

	@Update("update `config` set `value`=#{value}, `description`=#{description}, `modifyTime`=now()  where `key`=#{key}")
	public void update(Config config);

}
